/*
 *  AEdgecodeClip.cpp
 *  libavid
 *
 *  Created by Peter on 29.02.12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */

#include "AEdgecodeClip.h"
#include "AStream.h"

A_IMPLEMENT_CLASS( 'ECCP', AEdgecodeClip, AClip );

void AEdgecodeClip::readFromStream( AStream& str, const AObjDoc& objd )
{
	AClip::readFromStream( str, objd );
	
	UInt8 tagMark, version;
	str.readPod( tagMark );
	str.readPod( version );
	TR_ASSERT( tagMark == 0x02 );
	TR_ASSERT( version == 0x01 );
	
	str.readBuffer( _header, 8 );
	str.readPod( _filmKind );
	str.readPod( _codeFormat );
	str.readPod( _basePerf );
	str.readPod( _unused );
	str.readPod( _startEc );
	
	str.readPod( tagMark );
	TR_ASSERT( tagMark == 0x03 );
}

#define TRACE_FIELD( x ) "\t" #x ": " << x << std::endl
#define TRACE_CHAR_FIELD( x ) "\t" #x ": " << static_cast< int >( x ) << std::endl

void AEdgecodeClip::dump( std::ostream& str ) const
{
	str << "AEdgecodeClip {" << std::endl;
	
	str << "\t";
	AClip::dump( str );
	
	str << "\t..." << std::endl; // TODO: print all members here
	
	str << "}" << std::endl;
}